/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.matrimonybeans;

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;

/**
 *
 * @author 4410s
 */
@Stateless
public class Payment implements PaymentLocal {

    Connection conn;
    ResultSet rs = null;

    @Override
    public HashMap Select_Payment() {
        HashMap hmdata = new HashMap();
        try {
            ConnectDB conDB = new ConnectDB();
            conn = conDB.getConnection();
            String strSql = "SELECT * FROM ServicesDetails ";

            PreparedStatement pstmt = conn.prepareStatement(strSql);
            rs = pstmt.executeQuery();
            while (rs.next()) {
                HashMap hm = new HashMap();
                hm.put("id", rs.getInt("id"));
                hm.put("id_services", rs.getInt("id_services"));
                hm.put("username", rs.getString("username").trim());
                hm.put("date", rs.getTimestamp("date"));
                hm.put("card_types", rs.getString("card_types").trim());
                hm.put("card_number", rs.getString("card_number").trim());
                hm.put("status", rs.getString("status").trim());
                hm.put("username_admin", rs.getString("username_admin").trim());
                hmdata.put(rs.getInt("id"),hm);
            }

        } catch (SQLException ex) {
            Logger.getLogger(Payment.class.getName()).log(Level.SEVERE, null, ex);
        }
        return hmdata;
    }
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
}
